#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@Project : bigDataProject 
@File    : setting.py
@IDE     : PyCharm 
@Author  : Mario
@Date    : 2022/11/10 11:14 
@Describe: 获取文件路径
"""
import os
from typing import Text


def root_path() -> Text:
    """ 获取当前项目的根路径"""
    _path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    return _path


def ensure_path_sep(path: Text) -> Text:
    """兼容 windows 和 linux 不同环境的操作系统路径 """
    if "/" in path:
        path = os.sep.join(path.split("/"))
    if "\\" in path:
        path = os.sep.join(path.split("\\"))
    return root_path() + path


if __name__ == '__main__':
    print(ensure_path_sep("\\Log"))
